Rails.application.routes.draw do


  namespace :admin do
    resources :articles
  end
  namespace :admin do
    resources :article_categories
  end
post "/upload_file" => "upload#upload_file", :as => :upload_file
post "/upload_video" => "upload#upload_video", :as => :upload_video
post "/upload_image" => "upload#upload_image", :as => :upload_image
get "/download_file/:name" => "upload#access_file", :as => :upload_access_file, :name => /.*/

  namespace :admin do
    resources :frequent_asks
  end
  namespace :admin do
    resources :own_powers
  end
  get '/admin' => "admin/homes#index"

  get '/' => "web/homepages#index"
  namespace :web do
    resources :homes do
      collection do
        post :build_content_us
      end
    end

    resources :homepages do
      collection do
        get :about_us
        get :contact
        get :blog
        get :blog_detail
      end
    end
  end

  namespace :admin do
    resources :admin_users
    resources :sessions, only: [:index, :create, :new] do
      collection do
        post :logout
        post :login_admin_user
        get :login
      end
    end
    resources :user_customs
    resources :naviga_bars
    resources :technical_cores
    resources :carousels
    resources :teams
    resources :guest_books
    resources :company_cases
    resources :companies do
      post :set_used, on: :member
    end

    resources :hydropowers do
      member do
        post :import_file
        post :down_file
      end
    end
  end

  require 'sidekiq/web'
  mount Sidekiq::Web => '/sidekiq'
  Sidekiq::Web.use(Rack::Auth::Basic) do |user, password|
    [user, password] == ["sidekiqadmin", "yourpassword"]
  end
end
